<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>IGNORED</title>

    </h:head>
    <h:body>
        <ui:composition template="/templates/template.xhtml">
            <ui:define name="content">
                <h:outputStylesheet library="css" name="default.css"/>
                <h:form prependId="false">
                    <h2>#{tekster.Velg_eksempel} </h2>
                    <p:growl id="growl" globalOnly="true" sticky="false"/>
                    <p:panelGrid>
                        <f:facet name="header">
                            <p:row>
                                <p:column> #{tekster.Velg_kl} </p:column>
                                <p:column> #{tekster.Velg_op} </p:column>
                                <p:column> #{tekster.Velg_niv} </p:column>
                                <p:column> #{tekster.Velg_eksempel} </p:column>
                                <p:column> #{tekster.Skriv_inn_eks} </p:column>
                            </p:row>
                        </f:facet>

                        <p:row>

                            <p:column styleClass="columclass">
                                <p:selectOneListbox value="#{eks.k}" id="box" converterMessage="Converter failed" converter="#{klasseConverter}" styleClass="oddColumn" >
                                    <f:selectItems value="#{reg.klasser}" 
                                                   var="klasse"
                                                   itemLabel="#{klasse.toString()}"
                                                   itemValue="#{klasse}"/> 
                                    <f:ajax event="valueChange" execute="@this" render="box2 box3 box4 endretext knappen"/>

                                </p:selectOneListbox>
                            </p:column>
                            <p:column styleClass="columclass" >
                                <p:selectOneListbox  value="#{eks.operator}" styleClass="oddColumn" id="box2" >
                                    <f:selectItem itemValue="+" itemLabel="+"/>
                                    <f:selectItem itemValue="-" itemLabel="-"/>
                                    <f:selectItem itemValue="/" itemLabel="/"/>
                                    <f:selectItem itemValue="*" itemLabel="*"/>
                                    <f:ajax event="valueChange" execute="@this" render="box3 box4 endretext knappen"/>
                                </p:selectOneListbox>
                            </p:column>
                            <p:column styleClass="columclass">
                                <p:selectOneListbox converter="#{oppgaveSettConverter}" value="#{eks.o}" id="box3" styleClass="oddColumn">
                                    <f:selectItems value="#{reg.opgs}"
                                                   var="nivaa"
                                                   itemLabel="#{nivaa.toString()}"
                                                   itemValue="#{nivaa}"/>
                                    <f:ajax event="valueChange" execute="@this" render="box4 endretext knappen"/>
                                </p:selectOneListbox>
                            </p:column>
                            <p:column styleClass="columclass">
                                <p:selectOneListbox  id="box4" converter="#{eksempelConverter}" value="#{eks.eks}" styleClass="oddColumn">
                                    <f:selectItems value="#{reg.eksempelListe}" 
                                                   var="ek"
                                                   itemLabel="#{ek.toString()}"
                                                   itemValue="#{ek}"/> 
                                    <f:ajax event="valueChange" execute="@this" render="endretext knappen"/>
                                </p:selectOneListbox>
                            </p:column>
                            <p:column styleClass="columclass">
                                <p:inplace id="endretext" editor="true" styleClass="columclass" >
                                    <p:inputTextarea styleClass="oddColumn" maxlength="250" id="nyBeskrivelse" value="#{eks.beskrivelse}" required="true" label="text">
                                        <f:ajax event="valueChange" execute="@this" render="endretext knappen"/>
                                    </p:inputTextarea>
                                </p:inplace>

                            </p:column>
                        </p:row>
                    </p:panelGrid>
                    <p:commandButton id="knappen" update="growl" actionListener="#{gb.setEksempelGrowl(e)}" value="#{tekster.Lagre}" immediate="true" ajax="false" disabled="#{!eks.enabled}"/>
                </h:form>
            </ui:define>

            <ui:define name="left">
                <div align="center">
                    <h:commandLink action="/index?faces-redirect=true" immediate="true">
                        <h:graphicImage library="images" name="home.png"/>
                    </h:commandLink><br/><br/>
                    <p:commandButton ajax="false" action="/Ansatt/ansatt?faces-redirect=true" value="#{tekster.Tilbake_ansatt}" immediate="true" />
                </div>
            </ui:define>
        </ui:composition>

    </h:body>
</html>

